home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
T_BCINFO.ARJ
/
TI647.ASC
< prev
next >
Wrap
Text File
|
1992-02-25
|
2KB
|
67 lines
PRODUCT : Borland C++ NUMBER : 647
VERSION : 2.0
OS : PC DOS
DATE : February 25, 1992 PAGE : 1/1
TITLE : Correct Behavior for ins.getline()
"insp=&ins.get(ptr,sb,delim). Extracts characters and stores
them in the byte array beginning at ptr and extending for
len bytes. Extraction stops when delim is encountered
(delim is left in ins and not stored), when ins has no more
characters, or when the array has only one byte left. get
always stores a terminating null, even if it doesn't extract
any characters from ins because of its error status.
ios::failbit is set only if get encounters an end of file
before it stores any characters.
insp=&ins.getline(ptr,len,delim). Does the same thing as
ins.get(ptr,len,delim) with the exception that it extracts a
terminating delim character from ins. In case delim occurs
when exactly len characters have been extracted, termination
is treated as being due to the array being filled, and this
delim is left in ins."
pg. 4, AT&T C++ 2.0 Library Reference
As stated above, getline() is just like get() except that it
reads up to and including the delimiter but does not store the
delimiter in the buffer. get() reads up to but not including the
delim, so the delim is left unread in the stream. getline()
reads the delim and throws it away.
TC++ 1.00 has a problem in that getline() actually stores the
delimiter in the buffer; this behavior was a problem, not the
prescribed behavior for getline()!